<html>
<head>
<title>Simple XML HTTP request - Javascript</title>
<script type="text/javascript">
    var flickrUrl = '/proxy.jsp?url=http://api.flickr.com/services/feeds/photos_public.gne?format=xml&tags=dog';

    var xmlhttp;
    function send_request() {
        if (window.ActiveXObject) {
            // code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        } else {
            xmlhttp = new XMLHttpRequest();
        }
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                var xmlText;
                if (window.XMLSerializer) {
                    xmlText = new XMLSerializer().serializeToString(xmlhttp.responseXML);
                } else {
                    // code for IE
                    xmlText = xmlhttp.responseXML.xml;
                }
                document.getElementById('pre').appendChild(document.createTextNode( xmlText ));
            }
        }
        xmlhttp.open("GET",flickrUrl,true);
        xmlhttp.send(null);
    }
</script>
</head>
<body onload="send_request();" style="padding:40px">
<pre id="pre" style="width:500px;height:300px;border:1px solid blue;overflow:scroll;"/>
</body>
</html>
